import * as zrender from "zrender";
import { timeScaleHeight, unitWidth } from "../../config";
import { drawVerticalGridLines } from "./vertical-grid";
import { drawHorizontalGridLines } from "./horizontal-grid";

export { drawVerticalGridLines, drawHorizontalGridLines }

/**
 * 绘制时间轴背景
 * @param {Object} zr ZRender实例
 * @param {ChartState} chartState 图表状态对象
 */
export function drawTimeScaleBackground(zr: any, chartState: ChartState) {
  const timeScale = new zrender.Rect({
    shape: {
      x: chartState.chartStartX + chartState.lastScrollX,
      y: chartState.chartStartY - timeScaleHeight,
      width: chartState.timeScaleWidth * unitWidth,
      height: timeScaleHeight
    },
    style: {
      fill: "rgba(255, 0,0, .2)"
    }
  });
  zr.add(timeScale);
}

